/*
 * @Author: your name
 * @Date: 2021-09-03 16:32:34
 * @LastEditTime: 2021-09-03 16:34:47
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day10\10-例子.js
 */

function Animal(name, age) {
    this.name = name;
    this.age = age;
}

function Bird(weight, color) {
    this.weight = weight;
    this.color = color;
}
var a = new Animal("鸟类", 0);
Bird.prototype = a;
Bird.prototype.constructor = Bird;
Bird.prototype.fly = function() {
    console.log("I can fly " + this.color);
}
var b = new Bird(11, "black");
console.log(b.weight, b.name); //11 鸟类
b.fly(); //I can fly black
a.fly(); //I can fly undefined